package org.ndx.jsg.output.freemarker;

import java.io.File;

import org.apache.commons.configuration.Configuration;
import org.apache.tika.metadata.Metadata;
import org.ndx.jsg.input.FileInfosBuilder;
import org.ndx.jsg.input.adapter.BuilderAdapter;

public class NonTemplateBuidler extends BuilderAdapter implements
		FileInfosBuilder {

	private final String templatesExt;
	private final String librariesExt;

	public NonTemplateBuidler(Configuration config) {
		this.templatesExt = JsgXmlTransformer.getTemplatesExtension(config);
		this.librariesExt = JsgXmlTransformer.getLibrariesExtension(config);
	}

	@Override
	protected boolean matches(File f, String relativePath, Metadata metadata) {
		String name = f.getName();
		return !(name.endsWith(librariesExt) || name.endsWith(templatesExt));
	}
}
